﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<ThietBiSo.LinQDB.Slider>" %>

<%@ Import Namespace="ThietBiSo.LinQDB" %>
<%@ Import Namespace="ThietBiSo.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Website - bảng điều khiển
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%       
        Slider sp = (Slider)ViewData["Sliders"];
    %>
    <script type="text/javascript">
        function submitForm() {
            var F = document.forms[0];

            document.forms[0].submit();
        } 
    </script>
    <% using (Html.BeginForm("Edit", "Slide", FormMethod.Post, new { @enctype = "multipart/form-data" }))
       { %>
    <%: Html.ValidationSummary(true) %>
    <fieldset>
        <legend class="classFieldSet">Sửa </legend>
        <table width="100%">
            <tr>
                <td class="classCreate">
                    <input type="button" value="Luu" class="btn" onclick="submitForm();" />
                </td>
                <td class="classBack">
                    <%: Html.ActionLink("Quay lại", "Index",null,new { @class = "classThem" })%>
                </td>
            </tr>
            <tr>
                <td class="">
                    Hình đại diện
                </td>
                <td class="">
                    <%: Html.Hidden("HiddenHinhAnh", sp.TenHinh)%>
                    <table width="100%">
                        <tr>
                            <td>
                                <%:Html.TextBox("HinhAnh", sp.TenHinh)%>
                                <input type="button" value="Chọn ..." id="btnSelectImg" name="btnSelectImg" />
                                <script type="text/javascript">
                                    $(document).ready(function () {
                                        $("#btnSelectImg").click(function () {
                                            var finder = new CKFinder();
                                            finder.selectActionFunction = function (fileUrl) {
                                                $('#HinhAnh').val(fileUrl);
                                            };
                                            finder.popup();
                                        });
                                    });
                                </script>
                                <div style="color: Red">
                                    Kích thước hình: (1000 x 200) là tốt nhất. Có đuôi (*.jpg, *.jpeg, *.gif)</div>
                                <%--  <input class="field" type="file" name="fileUpload" id="fileUpload" />--%>
                            </td>
                            <td>
                                <%if (sp.TenHinh == "" || sp.TenHinh == null || sp.TenHinh == "noImage")
                                  {%>
                                <img src="<%:Url.Content("~/Content/images/nophoto.gif")%>" alt="" width="150px;"
                                    height="150px;" />
                                <%}
                                  else
                                  { %>
                                <img src="<%: sp.TenHinh%>" alt="" width="450px" height="150px" />
                                <%} %>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="tableLabel">
                    Thứ tự
                </td>
                <td class="tableField">
                    <%:Html.TextBox("ThuTu", sp.ThuTu)%>
                </td>
            </tr>
            <tr>
                <td height="20px">
                </td>
            </tr>
        </table>
    </fieldset>
    <% } %>
</asp:Content>
